﻿// Decompiled with JetBrains decompiler
// Type: DnProcessSimulateCommands.ModularFixture.CUiMFAddPrototypeDlg
// Assembly: DnProcessSimulateCommands, Version=2402.0.0.890, Culture=neutral, PublicKeyToken=null
// MVID: A885D881-AEDF-447E-852A-6F13102E089C
// Assembly location: C:\Program Files\Tecnomatix_2402\eMPower\DotNetCommands\DnProcessSimulateCommands.dll

using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Tecnomatix.Engineering;
using Tecnomatix.Engineering.Ui;


namespace DnProcessSimulateCommands.ModularFixture;

public class CUiMFAddPrototypeDlg : TxForm
{
  private Label label1;
  private Button m_ok;
  private Button m_cancel;
  private TxObjEditBoxCtrl m_prototype;
  private CApMFAdministratorManager m_adminManager;
  private IContainer components;

  public CUiMFAddPrototypeDlg(CApMFAdministratorManager manager)
  {
    this.m_adminManager = manager;
    this.InitializeComponent();
  }

  private void CUiMFAddPrototypeDlg_Load(object sender, EventArgs e)
  {
    this.m_prototype.SetPickProviders(new TxPickProvider[2]
    {
      (TxPickProvider) 4,
      (TxPickProvider) 6
    });
    this.m_prototype.ListenToPick = true;
    this.m_prototype.Focus();
    this.m_prototype.SetValidator((ITxValidator) new CApMFPrototypeValidator());
    this.m_ok.Enabled = false;
  }

  private void m_ok_Click(object sender, EventArgs e)
  {
    Cursor current = Cursor.Current;
    Cursor.Current = Cursors.WaitCursor;
    ((Form) this).Close();
    this.m_adminManager.AddPrototypeNodeToGrid(this.m_prototype.Object);
    Cursor.Current = current;
  }

  private void m_cancel_Click(object sender, EventArgs e) => ((Form) this).Close();

  private void m_prototype_Picked(object sender, TxObjEditBoxCtrl_PickedEventArgs args)
  {
    if (this.m_prototype.Object == null)
      this.m_ok.Enabled = false;
    else
      this.m_ok.Enabled = true;
  }

  private void m_prototype_TypeInvalid(object sender, EventArgs e) => this.m_ok.Enabled = false;

  protected virtual void Dispose(bool disposing)
  {
    if (disposing && this.components != null)
      this.components.Dispose();
    base.Dispose(disposing);
  }

  private void InitializeComponent()
  {
    ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof (CUiMFAddPrototypeDlg));
    this.label1 = new Label();
    this.m_ok = new Button();
    this.m_cancel = new Button();
    this.m_prototype = new TxObjEditBoxCtrl();
    ((Control) this).SuspendLayout();
    this.label1.AutoSize = true;
    this.label1.Location = new Point(12, 11);
    this.label1.Name = "label1";
    this.label1.Size = new Size(111, 13);
    this.label1.TabIndex = 0;
    this.label1.Text = "Resource/Unit Name:";
    this.m_ok.DialogResult = DialogResult.OK;
    this.m_ok.Location = new Point(76, 75);
    this.m_ok.Name = "m_ok";
    this.m_ok.Size = new Size(75, 23);
    this.m_ok.TabIndex = 2;
    this.m_ok.Text = "OK";
    this.m_ok.UseVisualStyleBackColor = true;
    this.m_ok.Click += new EventHandler(this.m_ok_Click);
    this.m_cancel.DialogResult = DialogResult.Cancel;
    this.m_cancel.Location = new Point(157, 75);
    this.m_cancel.Name = "m_cancel";
    this.m_cancel.Size = new Size(75, 23);
    this.m_cancel.TabIndex = 3;
    this.m_cancel.Text = "Cancel";
    this.m_cancel.UseVisualStyleBackColor = true;
    this.m_cancel.Click += new EventHandler(this.m_cancel_Click);
    this.m_prototype.ListenToPick = false;
    ((Control) this.m_prototype).Location = new Point(15, 37);
    ((Control) this.m_prototype).Name = "m_prototype";
    this.m_prototype.Object = (ITxObject) null;
    this.m_prototype.PickLevel = (TxPickLevel) 1;
    this.m_prototype.ReadOnly = false;
    ((Control) this.m_prototype).Size = new Size(216, 20);
    ((Control) this.m_prototype).TabIndex = 4;
    this.m_prototype.ValidatorType = (TxValidatorType) 1;
    this.m_prototype.TypeInvalid += new EventHandler(this.m_prototype_TypeInvalid);
    this.m_prototype.Picked += new TxObjEditBoxCtrl_PickedEventHandler(this.m_prototype_Picked);
    ((Form) this).AcceptButton = (IButtonControl) this.m_ok;
    ((ContainerControl) this).AutoScaleDimensions = new SizeF(6f, 13f);
    ((ContainerControl) this).AutoScaleMode = AutoScaleMode.Font;
    ((Form) this).CancelButton = (IButtonControl) this.m_cancel;
    ((Form) this).ClientSize = new Size(243, 108);
    ((Control) this).Controls.Add((Control) this.m_prototype);
    ((Control) this).Controls.Add((Control) this.m_cancel);
    ((Control) this).Controls.Add((Control) this.m_ok);
    ((Control) this).Controls.Add((Control) this.label1);
    ((Form) this).FormBorderStyle = FormBorderStyle.FixedDialog;
    ((Form) this).Icon = (Icon) componentResourceManager.GetObject("$this.Icon");
    ((Form) this).MaximizeBox = false;
    ((Form) this).MinimizeBox = false;
    ((Control) this).Name = nameof (CUiMFAddPrototypeDlg);
    ((Form) this).ShowIcon = false;
    ((Control) this).Text = "Select Resource/Unit Prototype";
    ((Form) this).TopMost = true;
    ((Form) this).Load += new EventHandler(this.CUiMFAddPrototypeDlg_Load);
    ((Control) this).ResumeLayout(false);
    ((Control) this).PerformLayout();
  }
}
